//////////////////////////////////////////////////////////////////////////
public:
	/// <summary>
	/// Decrements CvMat data reference counter and deallocates the data if
	/// it reaches 0
	/// </summary>
	static void DecRefData(IntPtr arr)
	{
		cvDecRefData((CvArr*)arr.ToPointer());
	}

	/// <summary>
	/// Increments CvMat data reference counter
	/// </summary>
	/// <returns></returns>
	static int IncRefData(IntPtr arr)
	{
		return  cvIncRefData((CvArr*)arr.ToPointer());
	}

	/// <summary>
	/// </summary>
	/// <param name="arr"></param>
	/// <param name="submat"></param>
	/// <returns></returns>
	static IntPtr GetRow(IntPtr arr, IntPtr submat, int row)
	{
		return IntPtr( cvGetRow((CvArr*)arr.ToPointer(), (CvMat*)submat.ToPointer(), row));
	}

	/// <summary>
	/// </summary>
	/// <param name="arr"></param>
	/// <param name="submat"></param>
	/// <returns></returns>
	static IntPtr GetCol(IntPtr arr, IntPtr submat, int col)
	{
		return IntPtr( cvGetCol((CvArr*)arr.ToPointer(), (CvMat*)submat.ToPointer(), col));
	}

	/// <summary>
	/// Releases CvMatND
	/// </summary>
	static void ReleaseMatND(IntPtr mat)
	{
		cvReleaseMatND((CvMatND**)mat.ToPointer());
	}

	/// <summary>
	/// returns next sparse array node (or NULL if there is no more nodes)
	/// </summary>
	/// <returns></returns>
	static IntPtr GetNextSparseNode(IntPtr mat_iterator)
	{
		return IntPtr(cvGetNextSparseNode((CvSparseMatIterator*)mat_iterator.ToPointer()));
	}

	/// <summary>
	/// dst(mask) = src(mask) - value = src(mask) + (-value)
	/// </summary>
	/// <param name="src"></param>
	/// <param name="value"></param>
	/// <param name="dst"></param>
	static void SubS(IntPtr src, NAMESPACE::Scalar value, IntPtr dst, IntPtr mask)
	{
		cvSubS((CvArr*)src.ToPointer(), *(CvScalar*)&value, (CvArr*)dst.ToPointer(), (CvArr*)mask.ToPointer());
	}

	/// <summary>
	/// dst(mask) = src(mask) - value = src(mask) + (-value)
	/// </summary>
	/// <param name="src"></param>
	/// <param name="value"></param>
	static void SubS(IntPtr src,  NAMESPACE::Scalar value, IntPtr dst)
	{
		cvSubS((CvArr*)src.ToPointer(), *(CvScalar*)&value, (CvArr*)dst.ToPointer());
	}

	/// <summary>
	/// </summary>
	/// <param name="seq"></param>
	/// <returns></returns>
	static IntPtr CloneSeq(IntPtr seq, IntPtr storage)
	{
		return IntPtr(cvCloneSeq((CvSeq*)seq.ToPointer(), (CvMemStorage*)storage.ToPointer()));
	}

	/// <summary>
	/// </summary>
	/// <returns></returns>
	static IntPtr CloneSeq(IntPtr seq)
	{
		return IntPtr(cvCloneSeq((CvSeq*)seq.ToPointer()));
	}

	/// <summary>
	/// Fast variant of cvSetAdd
	/// </summary>
	/// <returns></returns>
	static IntPtr SetNew(IntPtr set_header)
	{
		return IntPtr(cvSetNew((CvSet*)set_header.ToPointer()));
	}

	/// <summary>
	/// Removes set element given its pointer
	/// </summary>
	/// <param name="set_header"></param>
	static void SetRemoveByPtr(IntPtr set_header, IntPtr elem)
	{
		cvSetRemoveByPtr((CvSet*)set_header.ToPointer(), (void*)elem.ToPointer());
	}

	/// <summary>
	/// Returns a set element by index. If the element doesn't belong to the set,
	/// NULL is returned
	/// </summary>
	/// <param name="set_header"></param>
	/// <returns></returns>
	static IntPtr GetSetElem(IntPtr set_header, int index)
	{
		return IntPtr(cvGetSetElem((CvSet*)set_header.ToPointer(), index));
	}

	/// <summary>
	/// </summary>
	/// <param name="img"></param>
	/// <param name="box"></param>
	/// <param name="color"></param>
	/// <param name="thickness"></param>
	/// <param name="line_type"></param>
	static void EllipseBox(IntPtr img, NAMESPACE::Box2D box, NAMESPACE::Scalar color, int thickness, LineTypeFlag line_type, int shift)
	{
		cvEllipseBox((CvArr*)img.ToPointer(), *(CvBox2D*)&box, *(CvScalar*)&color, thickness, (int)line_type, shift);
	}

	/// <summary>
	/// </summary>
	/// <param name="img"></param>
	/// <param name="box"></param>
	/// <param name="color"></param>
	/// <param name="thickness"></param>
	static void EllipseBox(IntPtr img, NAMESPACE::Box2D box, NAMESPACE::Scalar color, int thickness, LineTypeFlag line_type)
	{
		cvEllipseBox((CvArr*)img.ToPointer(), *(CvBox2D*)&box, *(CvScalar*)&color, thickness, (int)line_type);
	}

	/// <summary>
	/// </summary>
	/// <param name="img"></param>
	/// <param name="box"></param>
	/// <param name="color"></param>
	static void EllipseBox(IntPtr img, NAMESPACE::Box2D box, NAMESPACE::Scalar color, int thickness)
	{
		cvEllipseBox((CvArr*)img.ToPointer(), *(CvBox2D*)&box, *(CvScalar*)&color, thickness);
	}

	/// <summary>
	/// </summary>
	/// <param name="img"></param>
	/// <param name="box"></param>
	static void EllipseBox(IntPtr img, NAMESPACE::Box2D box, NAMESPACE::Scalar color)
	{
		cvEllipseBox((CvArr*)img.ToPointer(), *(CvBox2D*)&box, *(CvScalar*)&color);
	}

	/// <summary>
	/// </summary>
	/// <param name="scale"></param>
	/// <returns></returns>
	static NAMESPACE::Font Font(double scale, int thickness)
	{
		return *(NAMESPACE::Font*)&cvFont(scale, thickness);
	}

	/// <summary>
	/// </summary>
	/// <returns></returns>
	static NAMESPACE::Font Font(double scale)
	{
		return *(NAMESPACE::Font*)&cvFont(scale);
	}

	/// <summary>
	/// </summary>
	/// <param name="node"></param>
	/// <returns></returns>
	static int ReadInt(IntPtr node, int default_value)
	{
		return cvReadInt((CvFileNode*)node.ToPointer(), default_value);
	}

	/// <summary>
	/// </summary>
	/// <returns></returns>
	static int ReadInt(IntPtr node)
	{
		return cvReadInt((CvFileNode*)node.ToPointer());
	}

	/// <summary>
	/// </summary>
	/// <param name="fs"></param>
	/// <param name="map"></param>
	/// <param name="name"></param>
	/// <returns></returns>
	static int ReadIntByName(IntPtr fs, IntPtr map, IntPtr name, int default_value)
	{
		return cvReadIntByName((CvFileStorage*)fs.ToPointer(), (CvFileNode*)map.ToPointer(), (char*)name.ToPointer(), default_value);
	}

	/// <summary>
	/// </summary>
	/// <param name="fs"></param>
	/// <param name="map"></param>
	/// <returns></returns>
	static int ReadIntByName(IntPtr fs, IntPtr map, IntPtr name)
	{
		return cvReadIntByName((CvFileStorage*)fs.ToPointer(), (CvFileNode*)map.ToPointer(), (char*)name.ToPointer());
	}

	/// <summary>
	/// </summary>
	/// <param name="node"></param>
	/// <returns></returns>
	static double ReadReal(IntPtr node, double default_value)
	{
		return cvReadReal((CvFileNode*)node.ToPointer(), default_value);
	}

	/// <summary>
	/// </summary>
	/// <returns></returns>
	static double ReadReal(IntPtr node)
	{
		return cvReadReal((CvFileNode*)node.ToPointer());
	}

	/// <summary>
	/// </summary>
	/// <param name="fs"></param>
	/// <param name="map"></param>
	/// <param name="name"></param>
	/// <returns></returns>
	static double ReadRealByName(IntPtr fs, IntPtr map, IntPtr name, double default_value)
	{
		return cvReadRealByName((CvFileStorage*)fs.ToPointer(), (CvFileNode*)map.ToPointer(), (char*)name.ToPointer(), default_value);
	}

	/// <summary>
	/// </summary>
	/// <param name="fs"></param>
	/// <param name="map"></param>
	/// <returns></returns>
	static double ReadRealByName(IntPtr fs, IntPtr map, IntPtr name)
	{
		return cvReadRealByName((CvFileStorage*)fs.ToPointer(), (CvFileNode*)map.ToPointer(), (char*)name.ToPointer());
	}

	/// <summary>
	/// </summary>
	/// <param name="node"></param>
	/// <returns></returns>
	static IntPtr ReadString(IntPtr node, IntPtr default_value)
	{
		return IntPtr((void*)cvReadString((CvFileNode*)node.ToPointer(), (char*)default_value.ToPointer()));
	}

	/// <summary>
	/// </summary>
	/// <returns></returns>
	static IntPtr ReadString(IntPtr node)
	{
		return IntPtr((void*)cvReadString((CvFileNode*)node.ToPointer()));
	}

	/// <summary>
	/// </summary>
	/// <param name="fs"></param>
	/// <param name="map"></param>
	/// <param name="name"></param>
	/// <returns></returns>
	static IntPtr ReadStringByName(IntPtr fs, IntPtr map, IntPtr name, IntPtr default_value)
	{
		return IntPtr((void*)cvReadStringByName((CvFileStorage*)fs.ToPointer(), (CvFileNode*)map.ToPointer(), (char*)name.ToPointer(), (char*)default_value.ToPointer()));
	}

	/// <summary>
	/// </summary>
	/// <param name="fs"></param>
	/// <param name="map"></param>
	/// <returns></returns>
	static IntPtr ReadStringByName(IntPtr fs, IntPtr map, IntPtr name)
	{
		return IntPtr((void*)cvReadStringByName((CvFileStorage*)fs.ToPointer(), (CvFileNode*)map.ToPointer(), (char*)name.ToPointer()));
	}

	/// <summary>
	/// decodes standard or user-defined object and returns it
	/// </summary>
	/// <param name="fs"></param>
	/// <param name="map"></param>
	/// <param name="name"></param>
	/// <returns></returns>
	static IntPtr ReadByName(IntPtr fs, IntPtr map, IntPtr name, IntPtr attributes)
	{
		return IntPtr(cvReadByName((CvFileStorage*)fs.ToPointer(), (CvFileNode*)map.ToPointer(), (char*)name.ToPointer(), (CvAttrList*)attributes.ToPointer()));
	}

	/// <summary>
	/// decodes standard or user-defined object and returns it
	/// </summary>
	/// <param name="fs"></param>
	/// <param name="map"></param>
	/// <returns></returns>
	static IntPtr ReadByName(IntPtr fs, IntPtr map, IntPtr name)
	{
		return IntPtr(cvReadByName((CvFileStorage*)fs.ToPointer(), (CvFileNode*)map.ToPointer(), (char*)name.ToPointer()));
	}


//////////////////////////////////////////////////////////////////////////